<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/6/1 0001
 * Time: 上午 11:08
 */
header('Content-type: text/json');
header("Access-Control-Allow-Origin:*");


    $conn = new mysqli("127.0.0.1","root","","cart");
    mysqli_query($conn,"set names utf8");
    //print_r($conn->connect_error);
    $sql = "SELECT proname FROM cartlist";
    $result = $conn->query($sql);
    $arr = array();
    if($result->num_rows >0){
        while($row = $result->fetch_assoc()){

            array_push($arr,$row);

        }
    }
    print_r(json_encode($arr));
    $conn->close();

